function signup()
{
	$.post("register/select_role.php",function(select_role){
	   if(select_role!="")
	   {
		   $('#entire').html(select_role);
	   }
	   });
}
function login(){
		$('#login_status').html('');
		$('#uid').removeClass('ErrorBox');
		$('#pwd').removeClass('ErrorBox');
		if($('#uid').val()==""){
			$('#login_status').html('Username Required').show().fadeOut(3000);
			$('#uid').addClass('ErrorBox');
			return false;
		}
		else if($('#pwd').val()==""){
			$('#login_status').html('Password Required').show().fadeOut(3000);
			$('#pwd').addClass('ErrorBox');
			return false;
		}
		else{
			$('#login_loading').show();
			$.post("plugins/checklogin.php",{userid:$('#uid').val(),password:$('#pwd').val()},function(data){
		$('#hits').html('<img src="img/status/loading.gif" width="48" height="12" />');
				if(data=="true")
				{
					$('#login_status').hide();
					$('#uid').removeClass('ErrorBox');
					$('#pwd').removeClass('ErrorBox');
					UpdateLeftPanel();
				}
				else
				{
					$('#login_status').html('( username or password seems to be wrong, please type the above carefully and check whether the capslock is on )').show().fadeOut(8000);
					$.post("includes/hits_display.php",function(hits){if(hits!="")
																		{
															$('#hits').html(hits+' hits today ');
																		}});
								$('#uid').addClass('ErrorBox');
					$('#pwd').addClass('ErrorBox');
				}
			});
		}
	}
	function forget_pass()
	{
		alert('forget');
	}
function load_register_form()
{
	$.post("register/register.php",function(register){
	$('#entire').html(register);
	});
	if($('#select_role').val()==1)
	{
		$.post("register/student_form.php",function(student_form){
		$('#InnerDarkBox').html(student_form);
		$('#Innerheading').html('Student Registration');
		});
	}
	else
	{
		$.post("register/staff_form.php",function(staff_form){
		$('#InnerDarkBox').html(staff_form);
		$('#Innerheading').html('Staff Registration');
		});
	}
}
function UpdateLeftPanel()
{
	$.post("plugins/link_seperator.php",function(data){
		$('#sts').html('<a href="plugins/logout.php">Logout</a>');
		 $('#leftpanel').html(data);
	$.post("plugins/log_front_content.php",function(front){
					  $('#entire').html(front);
					   });
		 		 });
}
function change_pass()
{
	$.post("plugins/change_pass.php",function(data){
								   $('#entire').html(data);
								   });
}
function change_pass_update()
{
	$('#change_pass_status').hide();
	$('#oldpass').removeClass('ErrorBox');
	$('#password').removeClass('ErrorBox');
	$('#repassword').removeClass('ErrorBox');
	if(chane_pass_Check()==false)return false;
	$.post("plugins/check_old_password.php",{oldpass:$('#oldpass').val()},function(data){if(data=="true"){
$.post("plugins/check_old_password.php",{password:$('#password').val()},function(up_data){
		$('#change_pass_status').removeClass('strykerError');
		$('#change_pass_status').addClass('strykerSuccess');
		$('#oldpass').val('');
		$('#password').val('');
		$('#repassword').val('');
		$('#change_pass_status').html('Password Changed Successfully').show(100);
																							 });																				
		}else{$('#oldpass').addClass('ErrorBox');
		$('#change_pass_status').html('Old password is not valid').show(100);
		return false;}});
}
function chane_pass_Check()
{
	if($('#oldpass').val()=="")
	{
		$('#oldpass').addClass('ErrorBox');
		$('#change_pass_status').html('Old password Required').show(100);
		return false;
	}
	else if($('#password').val()=="")
	{
		$('#password').addClass('ErrorBox');
		$('#change_pass_status').html('New password Required').show(100);
		return false;
	}
	else if($('#repassword').val()=="")
	{
		$('#repassword').addClass('ErrorBox');
		$('#change_pass_status').html('Re enter password Required').show(100);
		return false;
	}
	if($('#password').val().length<6)
	{
		$('#password').addClass('ErrorBox');
		$('#change_pass_status').html('Password should be more than 6 characters.').show(100);
		return false;
	}
	else if($('#password').val().length>40)
	{
		$('#password').addClass('ErrorBox');
		$('#change_pass_status').html('The password must be less than 40 characters.').show(100);
		return false;
	}
	else if($('#password').val().indexOf(' ')>=0)
	{
		$('#password').addClass('ErrorBox');
		$('#change_pass_status').html('Spaces not Allowed in password.').show(100);
		return false;
	}
	else if($('#password').val()!=$('#repassword').val())
	{
		$('#repassword').addClass('ErrorBox');
		$('#password').addClass('ErrorBox');
		$('#change_pass_status').html('Your passwords are not match').show(100);
		return false;
	}
	return true;
}
function show_dashboard()
{
	$.post("plugins/dashboard.php",function(data){
								   $('#entire').html(data);
								   });	
}
function check_Dash()
{
	if($('#email').val()=="")
	{
		$('#dash_message').html('Email Required').show().fadeOut(4000);
		return false;
	}
	else if($('#comments').val()=="")
	{
		$('#dash_message').html('Comments Required').show().fadeOut(4000);
		return false;
	}
	else
	{
		$.post("plugins/dash_update.php",{email:$('#email').val(),comments:$('#comments').val()},function(data){
				show_dashboard();
				$('#notice').html('Your comments successfully updated').show().fadeOut(4000);
			});
	}
}